package val.to.server;

import java.util.ArrayList;
import java.util.Date;
import val.to.entities.Event;
import val.to.entities.FeedFilterType;
import val.to.entities.FeedItem;
import val.to.entities.PhotoPost;
import android.location.Location;

public interface IServerPortal {

	public class FeedUpdate{
		public ArrayList<FeedItem> newItems;
		public ArrayList<Integer> deletedItems;
		public Date lastUpdate;
		
		public FeedUpdate(ArrayList<FeedItem> newItems, ArrayList<Integer> deletedItems, Date lastUpdate){
			this.newItems = newItems;
			this.deletedItems = deletedItems;
			this.lastUpdate = lastUpdate;
		}
		
		@Override
		public String toString() {
			return String.format("Updated at: %s, new items: %d, deleted items: %d", 
					lastUpdate.toGMTString(), 
					newItems.size(), 
					deletedItems.size());
		}
	}
	
	
	/**
	 * Gets the last REST portal error.
	 * @return
	 */
	String getLastError();
	
	/**
	 * 
	 * @param location
	 * @return
	 */
	ArrayList<Event> getEvents(Location location);
	
	/**
	 * @return
	 */
	ArrayList<Event> getOwnerEvents();

	/**
	 * 
	 * @param eventId
	 * @param refDate
	 * @param lastUpdate
	 * @param maxCount
	 * @param forward
	 * @param filterType
	 * @return
	 */
	FeedUpdate getFeedItems(int eventId, Date refDate, Date lastUpdate, int maxCount, boolean forward, FeedFilterType filter);
	
	/**
	 * 
	 * @param newEvent
	 * @return
	 */
	boolean postEvent(Event newEvent);
	
	/**
	 * 
	 * @param updatedEvent
	 * @return
	 */
	boolean updateEvent(Event event);

	/**
	 * 
	 * @param existingEvent
	 * @return
	 */
	boolean deleteEvent(Event event);
	
	/**
	 * 
	 * @param Event
	 * @return
	 */
	boolean exportEvent(Event Event);

	/**
	 * 
	 * @param photoPost
	 * @return
	 */
	boolean postPhoto(PhotoPost photoPost, int targetEventId);
	
	/**
	 * 
	 * @param eventId
	 * @param photoId
	 * @return
	 */
	boolean deletePhoto(int eventId, int photoId);
	
	/**
	 * 
	 * @param eventId
	 * @return
	 */
	boolean checkIntoEvent(int eventId);

	/**
	 * 
	 * @param eventId
	 * @return
	 */
	boolean shareEvent(int eventId);

	/**
	 * 
	 * @param eventId
	 * @return
	 */
	ArrayList<String> getFriendsListCheckedInEvent(int eventId);
	
	
	//TODO:
	//Exception getLastError();
}
